<?php

namespace app\modules\api\controllers;

use Yii;
use app\modules\api\models\Position;
use yii\data\ActiveDataProvider;
use yii\rest\ActiveController;
use yii\web\NotFoundHttpException;
use yii\web\ServerErrorHttpException;

/**
 * @OA\Tag(
 *      name="Position",
 *      description="岗位管理",
 * )
 */
class PositionController extends ActiveController
{
    public $modelClass = 'app\modules\api\models\Position';

    /**
     * @OA\Post(
     *      path="/position/create",
     *      tags={"Group"},
     *      summary="岗位 - 添加（ 接收表单提交 ）",
     *      @OA\RequestBody(
     *          @OA\MediaType(
     *              mediaType="multipart/form-data",
     *              @OA\Schema(
     *                  required={"groupId", "deptId", "name"},
     *                  @OA\Property(property="groupId", type="integer", description="组织ID", default="0"),
     *                  @OA\Property(property="deptId", type="integer", description="部门ID", default="0"),
     *                  @OA\Property(property="parentId", type="integer", description="上级ID", default="0"),
     *                  @OA\Property(property="name", type="string", description="组织名称"),
     *                  @OA\Property(property="sort", type="integer", description="排序值", default="0"),
     *                  @OA\Property(property="setDefault", type="boolean", description="设置为默认权限", default="false"),
     *                  @OA\Property(
     *                      property="item[]",
     *                      type="array",
     *                      description="权限项",
     *                      @OA\Items(type="integer")
     *                  ),
     *                  @OA\Property(
     *                      property="auth[]",
     *                      type="array",
     *                      description="权限项对应的数据授权类型",
     *                      @OA\Items(type="integer")
     *                  ),
     *                  @OA\Property(
     *                      property="data[]",
     *                      type="array",
     *                      description="权限项对应的自定义数据授权的值",
     *                      @OA\Items(type="integer")
     *                  ),
     *             )
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionCreate()
    {
    }

    /**
     * @OA\Post(
     *      path="/position/update",
     *      tags={"Group"},
     *      summary="岗位 - 编辑（ 接收表单提交 ）",
     *      @OA\Parameter(
     *          name="id",
     *          in="query",
     *          description="岗位ID",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *          ),
     *      ),
     *      @OA\RequestBody(
     *          @OA\MediaType(
     *              mediaType="multipart/form-data",
     *              @OA\Schema(
     *                  required={"name"},
     *                  @OA\Property(property="name", type="string", description="组织名称"),
     *                  @OA\Property(property="sort", type="integer", description="排序值", default="0"),
     *                  @OA\Property(property="setDefault", type="boolean", description="设置为默认权限", default="false"),
     *                  @OA\Property(
     *                      property="item[]",
     *                      type="array",
     *                      description="权限项",
     *                      @OA\Items(type="integer")
     *                  ),
     *                  @OA\Property(
     *                      property="auth[]",
     *                      type="array",
     *                      description="权限项对应的数据授权类型",
     *                      @OA\Items(type="integer")
     *                  ),
     *                  @OA\Property(
     *                      property="data[]",
     *                      type="array",
     *                      description="权限项对应的自定义数据授权的值",
     *                      @OA\Items(type="integer")
     *                  ),
     *             )
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionUpdate()
    {
    }

    /**
     * @OA\Post(
     *      path="/position/delete",
     *      summary="岗位 - 删除（ 接收表单提交 ）",
     *      tags={"Group"},
     *      @OA\Parameter(
     *          description="岗位ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionDelete()
    {
    }

    /**
     * @OA\Get(
     *      path="/position/view",
     *      summary="岗位 - 详情查看",
     *      tags={"Group"},
     *      @OA\Parameter(
     *          description="岗位ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="user",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="realName", type="string", example="张三", description="用户姓名"),
     *                          @OA\Property(property="dept", type="string", example="销售一部", description="所在部门"),
     *                          @OA\Property(property="phone", type="string", example="13800000000", description="手机号码"),
     *                          @OA\Property(property="email", type="string", example="admin@qq.com", description="邮箱"),
     *                          @OA\Property(property="role", type="string", example="营养师", description="角色"),
     *                          @OA\Property(property="online", type="boolean", example="true", description="在线"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="position",
     *                      type="object",
     *                      @OA\Property(property="name", type="string", example="销售一部", description="岗位名称"),
     *                      @OA\Property(property="dept", type="string", example="销售-电商部", description="所属部门"),
     *                  ),
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionView()
    {

    }

    /**
     * @OA\Get(
     *      path="/position/get-drop-list",
     *      summary="岗位 - 下拉列表 （ 添加、编辑时调用 ）",
     *      tags={"Position"},
     *      @OA\Parameter(
     *          description="组织ID",
     *          in="query",
     *          name="groupId",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Parameter(
     *          description="部门ID",
     *          in="query",
     *          name="deptId",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="经理", description="岗位名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="岗位ID"),
     *                      ),
     *                  ),
     *                  example={"name":"经理", "id": 1}
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetDropList()
    {

    }

    /**
     * @OA\Get(
     *      path="/position/get-info",
     *      summary="岗位 - 编辑时的信息（ 编辑时调用 ）",
     *      tags={"Position"},
     *      @OA\Parameter(
     *          description="岗位ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="position",
     *                      type="object",
     *                      @OA\Property(property="id", type="integer", example="1", description="id"),
     *                      @OA\Property(property="groupId", type="integer", example="1", description="组织ID"),
     *                      @OA\Property(property="parentId", type="integer", example="0", description="上级ID"),
     *                      @OA\Property(property="deptId", type="integer", example="1", description="部门ID"),
     *                      @OA\Property(property="name", type="string", example="经理", description="岗位名称"),
     *                  ),
     *                  @OA\Property(
     *                      property="group",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="晟田集团", description="组织名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="组织ID"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="dept",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="技术部", description="部门名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="部门ID"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="list",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="经理", description="岗位名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="岗位ID"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="item",
     *                      type="array",
     *                      @OA\Items(
     *                          type="object",
     *                          @OA\Property(property="id", type="integer", example=1, description="权限项ID"),
     *                          @OA\Property(property="parentId", type="integer", example=0, description="上级ID"),
     *                          @OA\Property(property="name", type="string", example="客户管理", description="权限项名称"),
     *                          @OA\Property(property="auth", type="integer", example=1, description="是否需要数据权限（ 0：否、1：是 、2：字段权限）"),
     *                          @OA\Property(property="type", type="integer", example=0, description="数据权限类型（0：不需要、其它见 typeList）"),
     *                          @OA\Property(property="checked", type="boolean", example=true, description="选中（ true：是、false：否 ）"),
     *                          @OA\Property(property="status", type="integer", example=0, description="状态（ 0：禁用、1：启用 ）"),
     *                          @OA\Property(
     *                              property="children",
     *                              type="array",
     *                              @OA\Items(
     *                                  type="object",
     *                                  @OA\Property(property="id", type="integer", example=1, description="权限项ID"),
     *                                  @OA\Property(property="parentId", type="integer", example=0, description="上级ID"),
     *                                  @OA\Property(property="name", type="string", example="客户", description="权限项名称"),
     *                                  @OA\Property(property="auth", type="integer", example=1, description="是否需要数据权限（ 0：否、1：是 、2：字段权限）"),
     *                                  @OA\Property(property="type", type="integer", example=0, description="数据权限类型（0：不需要、其它见 typeList）"),
     *                                  @OA\Property(property="checked", type="boolean", example=true, description="选中（ true：是、false：否 ）"),
     *                                  @OA\Property(property="status", type="integer", example=0, description="状态（ 0：禁用、1：启用 ）"),
     *                                  @OA\Property(
     *                                      property="children",
     *                                      type="array",
     *                                          @OA\Items(
     *                                          @OA\Property(property="id", type="integer", example=1, description="权限项ID"),
     *                                          @OA\Property(property="parentId", type="integer", example=0, description="上级ID"),
     *                                          @OA\Property(property="name", type="string", example="列表", description="权限项名称"),
     *                                          @OA\Property(property="auth", type="integer", example=1, description="是否需要数据权限（ 0：否、1：是 、2：字段权限）"),
     *                                          @OA\Property(property="type", type="integer", example=0, description="数据权限类型（0：不需要、其它见 typeList）"),
     *                                          @OA\Property(property="checked", type="boolean", example=true, description="选中（ true：是、false：否 ）"),
     *                                          @OA\Property(property="status", type="integer", example=0, description="状态（ 0：禁用、1：启用 ）"),
     *                                          @OA\Property(
     *                                             property="children",
     *                                             type="array",
     *                                             @OA\Items()
     *                                          )
     *                                      )
     *                                  )
     *                              )
     *                          )
     *                      )
     *                  ),
     *
     *
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetInfo()
    {

    }

    /**
     * @OA\Get(
     *      path="/position/get-item-data",
     *      summary="岗位 - 自定义数据授权 组织&部门树形（ 岗位 编辑 自定义数据授权选择时调用 ）",
     *      tags={"Position"},
     *      @OA\Parameter(
     *          description="岗位ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Parameter(
     *          description="权限项ID",
     *          in="query",
     *          name="itemId",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="group",
     *                      type="array",
     *                      @OA\Items(
     *                          type="object",
     *                          @OA\Property(property="id", type="integer", example=1, description="组织ID"),
     *                          @OA\Property(property="name", type="string", example="晟田集团", description="组织名称"),
     *                          @OA\Property(property="count", type="integer", example=2000, description="组织下的人数统计"),
     *                          @OA\Property(
     *                              property="children",
     *                              type="array",
     *                              @OA\Items(
     *                                  type="object",
     *                                  @OA\Property(property="id", type="integer", example=1, description="部门ID"),
     *                                  @OA\Property(property="parentId", type="integer", example=0, description="部门上级ID"),
     *                                  @OA\Property(property="name", type="string", example="IT部门", description="部门名称"),
     *                                  @OA\Property(property="count", type="integer", example=3, description="部门下的人数统计"),
     *                                  @OA\Property(property="checked", type="boolean", example="true", description="是否选中（ true：是、false：否 ）"),
     *                                  @OA\Property(
     *                                      property="children",
     *                                      type="array",
     *                                      @OA\Items(
     *                                          @OA\Property(property="id", type="integer", example=2, description="部门ID"),
     *                                          @OA\Property(property="parentId", type="integer", example=1, description="部门上级ID"),
     *                                          @OA\Property(property="name", type="string", example="技术开发部", description="部门名称"),
     *                                          @OA\Property(property="count", type="integer", example=3, description="部门下的人数统计"),
     *                                          @OA\Property(property="checked", type="boolean", example="true", description="是否选中（ true：是、false：否 ）"),
     *                                          @OA\Property(
     *                                             property="children",
     *                                             type="array",
     *                                             @OA\Items()
     *                                          )
     *                                      )
     *                                  )
     *                              )
     *                          )
     *                      )
     *                  )
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetItemData()
    {
    }

    /**
     * @OA\Get(
     *      path="/position/get-default-item",
     *      summary="岗位 默认的权限项树形（ 勾选为使用默认权限时调用 ）",
     *      tags={"Position"},
     *      @OA\Parameter(
     *          description="岗位ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="item",
     *                      type="array",
     *                      @OA\Items(
     *                          type="object",
     *                          @OA\Property(property="id", type="integer", example=1, description="权限项ID"),
     *                          @OA\Property(property="parentId", type="integer", example=0, description="上级ID"),
     *                          @OA\Property(property="name", type="string", example="客户管理", description="权限项名称"),
     *                          @OA\Property(property="auth", type="integer", example=1, enum={0, 1, 2}, description="是否需要数据权限（ 0：不需要、1：需要 、2：字段权限）"),
     *                          @OA\Property(property="type", type="integer", example=0, enum={1, 2, 3, 4}, description="数据权限类型（ 1：读写、2：只读、3：只读密文、4：不可见 ）"),
     *                          @OA\Property(property="checked", type="boolean", example=true, description="选中（ true：是、false：否 ）"),
     *                          @OA\Property(property="status", type="integer", example=0, description="状态（ 0：禁用、1：启用 ）"),
     *                          @OA\Property(
     *                              property="children",
     *                              type="array",
     *                              @OA\Items(
     *                                  type="object",
     *                                  @OA\Property(property="id", type="integer", example=1, description="权限项ID"),
     *                                  @OA\Property(property="parentId", type="integer", example=0, description="上级ID"),
     *                                  @OA\Property(property="name", type="string", example="客户", description="权限项名称"),
     *                                  @OA\Property(property="auth", type="integer", example=1, enum={0, 1, 2}, description="是否需要数据权限（ 0：不需要、1：需要 、2：字段权限）"),
     *                                  @OA\Property(property="type", type="integer", example=0, enum={1, 2, 3, 4}, description="数据权限类型（ 1：读写、2：只读、3：只读密文、4：不可见 ）"),
     *                                  @OA\Property(property="checked", type="boolean", example=true, description="选中（ true：是、false：否 ）"),
     *                                  @OA\Property(property="status", type="integer", example=0, description="状态（ 0：禁用、1：启用 ）"),
     *                                  @OA\Property(
     *                                      property="children",
     *                                      type="array",
     *                                          @OA\Items(
     *                                          @OA\Property(property="id", type="integer", example=1, description="权限项ID"),
     *                                          @OA\Property(property="parentId", type="integer", example=0, description="上级ID"),
     *                                          @OA\Property(property="name", type="string", example="列表", description="权限项名称"),
     *                                          @OA\Property(property="auth", type="integer", example=1, enum={0, 1, 2}, description="是否需要数据权限（ 0：不需要、1：需要 、2：字段权限）"),
     *                                          @OA\Property(property="type", type="integer", example=0, enum={1, 2, 3, 4}, description="数据权限类型（ 1：读写、2：只读、3：只读密文、4：不可见 ）"),
     *                                          @OA\Property(property="checked", type="boolean", example=true, description="选中（ true：是、false：否 ）"),
     *                                          @OA\Property(property="status", type="integer", example=0, description="状态（ 0：禁用、1：启用 ）"),
     *                                          @OA\Property(
     *                                             property="children",
     *                                             type="array",
     *                                             @OA\Items()
     *                                          )
     *                                      )
     *                                  )
     *                              )
     *                          )
     *                      )
     *                  ),
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetDefaultItem()
    {

    }

    /**
     * @OA\Get(
     *      path="/position/get-tree-list",
     *      summary="某组织 或 某部门 下的 岗位 树形列表（ 组织首页，左侧选择时 调用 ）",
     *      tags={"Group"},
     *      @OA\Parameter(
     *          name="groupId",
     *          in="query",
     *          description="岗位ID（ 为空时部门ID不能为空 ）",
     *          required=false,
     *          @OA\Schema(
     *              type="integer",
     *          ),
     *      ),
     *      @OA\Parameter(
     *          name="deptId",
     *          in="query",
     *          description="部门ID（ 为空时组织ID不能为空 ）",
     *          required=false,
     *          @OA\Schema(
     *              type="integer",
     *          ),
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="Ok",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="position",
     *                      type="array",
     *                      @OA\Items(
     *                          type="object",
     *                          @OA\Property(property="id", type="integer", example=1, description="岗位ID"),
     *                          @OA\Property(property="parentId", type="integer", example=0, description="岗位上级ID"),
     *                          @OA\Property(property="name", type="string", example="经理", description="岗位名称"),
     *                          @OA\Property(property="count", type="integer", example=1, description="岗位下的人数统计"),
     *                          @OA\Property(
     *                              property="children",
     *                              type="array",
     *                              @OA\Items(
     *                                  type="object",
     *                                  @OA\Property(property="id", type="integer", example=2, description="岗位ID"),
     *                                  @OA\Property(property="parentId", type="integer", example=1, description="岗位上级ID"),
     *                                  @OA\Property(property="name", type="string", example="组员", description="岗位名称"),
     *                                  @OA\Property(property="count", type="integer", example=3, description="岗位下的人数统计"),
     *                              )
     *                          )
     *                      ),
     *                  ),
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetTreeList()
    {

    }
}
